from qt import *
from tablewindow import TableWindow

class ThreadWindow(TableWindow):
    TITLE = 'Threads'

    def __init__(self, parent=None):
        super(ThreadWindow, self).__init__(parent, ['Id', 'Entry', 'DataBlock', 'LastError', 'Status', 'Priority', 'UserTime', 'SystemTime'])
        
        self.table.setContextMenuPolicy(Qt.CustomContextMenu)
        self.table.customContextMenuRequested.connect(self.on_context_menu)

    def on_context_menu(self):
        menu = QMenu(self)
        menu.addAction(QAction('Refresh', self, triggered=self.refresh_threads))
        menu.popup(QCursor.pos())
        
    def refresh_threads(self):
        1/0
        
    